// 暴露多个接口函数,封装接口请求函数

const BASE_URL='/api';
import ajax from './ajax.js'
//1.获取地理位置信息
export const reqAddress= (geohash)=> {return ajax(`${BASE_URL}/position/${geohash}`) };
//2.获取食物列表信息
export const reqFoodCategorys= ()=> {return ajax(BASE_URL+"/index_category")};
//3.获取店铺列表
export const reqShops= ({latitude,longitude})=> {return  ajax(BASE_URL+"/shops",{latitude,longitude}) };


//4.根据经纬度和关键字搜索店铺列表
//自己写mock数据
export const reqSearchShop= (geohash,keyword)=> {return     ajax("/search_shops",{keyword,geohash},"POST") };//,,
//标准api文档要求的
// export const reqSearchShop= (geohash,keyword)=> {return     ajax(BASE_URL+"/search_shops",{keyword,geohash}) };


//5.获取一次性验证码
//6.用户名.密码.图形验证码登录：http://localhost:3000/login_pwd
export const reqPwdLogin=({name,pwd,captcha})=>{ return ajax(BASE_URL+"/login_pwd",{name,pwd,captcha},'POST')};
//7.发送短信验证码
export const reqSendCode= ({phone})=> {return     ajax(BASE_URL+"/sendcode",{phone})};

//8.手机号验证登录
export const reqSmsLogin= ({phone,code})=>{ return  ajax(BASE_URL+'/login_sms',{phone,code},'POST')};
//9.根据回话获取用户信息
export const reqUserInfo= ()=>{return ajax(BASE_URL+"/userinfo")};
//10.用户登出
export const reqLogout=()=>{return ajax(BASE_URL+"/logout") };

//获取店铺info
export const reqShopInfo=()=>{return ajax('/info')};
//获取店铺食品推荐优惠列表goods
export const reqShopGoods=()=>{return ajax('/goods')};
//获取店铺评论
export const reqShopRatings=({id})=>{return ajax('/ratings',{id},"POST")};
